home *** CD-ROM | disk | FTP | other *** search
/ Amoszine 11 / Amoszine 11 (Disk 2 of 2).adf / Various_Source.lha / az_hd_installer.amos / az_hd_installer.amosSourceCode next >
Encoding:
AMOS Source Code  |  1996-03-06  |  3.4 KB  |  171 lines

  1. '--------------------------------------------------------------------- 
  2. ' Amoszine installer - By Andrew Smith  1994 
  3.  
  4. ' Written for Amoszine using AMOS Professional v2.0
  5. '--------------------------------------------------------------------- 
  6.  
  7. ' This is very old and is of no practical use anymore, but the routines
  8. ' can be used to create your own pwersonal installers. 
  9. '
  10. ' I don't think Az ever used this for some reason or another!
  11. '  
  12. ' Thanx anyway Andy. -AG 
  13. '  
  14. Dim CL(16) : Dim SCRIPT$(50)
  15.  
  16. Unpack 15 To 0
  17. Screen Display 0,,150,,
  18. Screen Hide 0
  19.  
  20. ' Make mouse pointer prettier
  21.  
  22. Colour 17,$FFF : Colour 19,$A
  23.  
  24. ' Store colour palette in array
  25.  
  26. For T=0 To 15
  27.    CL(T)=Colour(T)
  28. Next T
  29.  
  30. ' Wipe colours 
  31.  
  32. For T=0 To 15
  33.    Colour T,$0
  34. Next T
  35.  
  36. ' Show screen and do a nice fade in
  37.  
  38. Screen Show 0
  39.  
  40. Fade 3,CL(0),CL(1),CL(2),CL(3),CL(4),CL(5),CL(6),CL(7),CL(8),CL(9),CL(10),CL(11),CL(12),CL(13),CL(14),CL(15)
  41. Wait 45
  42.  
  43. ' Move logo to top of screen 
  44.  
  45. For Y=150 To 40 Step -2
  46.    Screen Display 0,,Y,,
  47.    Wait Vbl 
  48. Next Y
  49.  
  50. Global DESTDIR$
  51.  
  52. ' The DEST$ variable contains the path to install to 
  53.  
  54. Wind Save 
  55. Wind Open 1,124,100,48,4,3
  56. Window 1
  57. Border 3,6,15
  58. Title Top "Enter device to install to ..."
  59. Pen 15
  60. Input DEST$
  61. Wind Close 
  62. Clear Key 
  63.  
  64. Paper 0 : Pen 15
  65.  
  66. ' Store script in array to minimize on disk swapping.
  67.  
  68. Open In 1,"dirs.dta"
  69. COUNT=1
  70. Repeat 
  71.    Input #1,LINE$
  72.    SCRIPT$(COUNT)=LINE$
  73.    Inc COUNT
  74. Until Eof(1)
  75. Close 1
  76.  
  77. COUNT=1
  78. Repeat 
  79.    LINE$=SCRIPT$(COUNT)
  80.    Inc COUNT
  81.    
  82.    ' Find position of first colon 
  83.    
  84.    POS=Instr(LINE$,":")
  85.    
  86.    ' Get size of line minus POS.  
  87.    
  88.    SIZEOFDIR=Len(LINE$)-POS
  89.    
  90.    ' Get directory name without shite 
  91.    
  92.    DESTDIR$=Mid$(LINE$,POS+1,SIZEOFDIR-1)
  93.    
  94.    ' Get ARCHIVE: and stick it with directory name
  95.    ' e.g.  archive:source_code
  96.    
  97.    DESTDIR$=DEST$+DESTDIR$
  98.    
  99.    ' If directory already exists then don't bother creating it
  100.    
  101.    If Not Exist(DESTDIR$)
  102.       Mkdir DESTDIR$
  103.    End If 
  104.    
  105.    ' Copy one directory at a time 
  106.    
  107.    Dir$=LINE$
  108.    Centre At(,31)+"                                                               "
  109.    Centre At(,31)+"Installing : "+LINE$
  110.    F$=Dir First$("**")
  111.    Repeat 
  112.       If Left$(F$,1)<>"*"
  113.          
  114.          ' Strip uneeded leading space from f$  
  115.          
  116.          F$=Mid$(F$,2,35)
  117.          
  118.          ' Find position of first space, after filename 
  119.          
  120.          POS=Instr(F$," ")
  121.          
  122.          ' Get filename without any junk and store in f$
  123.          
  124.          F$=Mid$(F$,1,POS-1)
  125.          If Len(F$)=>29
  126.             F$=Left$(F$,29)
  127.          End If 
  128.          
  129.          ' Copy file
  130.          
  131.          If Right$(LINE$,1)=":"
  132.             _COPYFILE[F$,DESTDIR$+F$,14]
  133.          Else 
  134.             _COPYFILE[F$,DESTDIR$+"/"+F$,14]
  135.          End If 
  136.       End If 
  137.       F$=Dir Next$
  138.    Until F$=""
  139.    
  140. Until SCRIPT$(COUNT)=""
  141. Bell 
  142. Wind Save 
  143. Wind Open 1,124,100,48,4,3
  144. Window 1
  145. Border 3,6,15
  146. Title Top "Amoszine Installer Message"
  147. Pen 15
  148. Centre At(,0)+"Installation complete!"
  149. Centre At(,1)+"Click mouse or press a key"
  150. Repeat 
  151.    X$=Inkey$
  152. Until(Mouse Key) or(X$<>"")
  153. Wind Close 
  154.  
  155. Fade 3 : Wait 45
  156.  
  157. Procedure _COPYFILE[SOURCE$,DESTINATION$,BANK]
  158.  
  159.    Open In 2,SOURCE$
  160.    Reserve As Work BANK,Lof(2)
  161.    Bload SOURCE$,BANK
  162.    Close 2
  163.    Bsave DESTINATION$,Start(BANK) To Start(BANK)+Length(BANK)
  164.  
  165.    ' This line is provided for compatability with AMOS 1.3
  166.    ' If it is removed, then the error 'Bank already reserved' appears 
  167.    ' under AMOS classic.
  168.  
  169.    Erase BANK
  170.  
  171. End Proc[ERRMESS$]